s=input().split()
s=s[1:]
max=0
for i in range(len(s)):
    cnt=s.count(s[i])
    if max<cnt:
        max=cnt
        num=s[i]
print(num,max)
